home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-15 | 3.4 KB | 107 lines | [TEXT/MPS ] |
- include 'SysErr.a'
- include 'SysEqu.a'
- include 'Traps.a'
-
- allRegs REG D0-D7/A0-A5
-
- proc
-
- import PurgeAllBlocks
-
- ; ————————————————————————————————————————————————————————————————————————————
- ;
-
- export SaveMyA5, GetMyA5
-
- pMyA5 dc.l 0
-
- SaveMyA5
- lea pMyA5,A0
- move.l A5,(A0)
- rts
-
- GetMyA5
- move.l pMyA5,4(SP)
- rts
-
-
- ; ————————————————————————————————————————————————————————————————————————————
- ;
- ; Storage for the old patch addresses, used to call through once the patch
- ; code executes. These are essentially globals, used by the asm code. They are
- ; specifically not exported, so that the Pascal code cannot access them
- ; directly. There are a number of interface routines I set up so that Pascal
- ; can get and set them, but has to go through this file. You know, sort of
- ; object like.
- ;
- pFirstSavedTrap equ *
- pOldNewPtr dc.l 0
- pOldNewHandle dc.l 0
- pOldReallocHandle dc.l 0
- pOldSetPtrSize dc.l 0
- pOldSetHandleSize dc.l 0
- pOldMoveHHi dc.l 0
-
- ; ————————————————————————————————————————————————————————————————————————————
- ; When I'm am setting up the world, I call NGetTrapAddress to get the old
- ; version of the traps. I need to save that dude off so I can get back there
- ; when needed. This routine is a handy interface to the high-level world,
- ; isolating this asm junk from the code. All these routines are the same, just
- ; a different variable being affected. This hunk uses the PC-Relative
- ; addressing mode in order to get the address of the variable being set. This
- ; allows the code to function without any explicit global space, since the
- ; code acts like globals here.
- ;
- ; The interface is:
- ;
- ; PROCEDURE SaveOldTrapAddress (address: LongInt; addressKind: Integer);
- ;
-
- export SaveOldTrapAddress
-
- SaveOldTrapAddress
- MOVE.L (SP)+,A0 ; get the return address
- move.w (SP)+,D0
- asl.w #2,D0
- LEA pFirstSavedTrap,A1 ; the variable to be setting
-
- MOVE.L (SP)+,(A1,D0.w) ; save it, pulling parameter too
- JMP (A0) ; it's saved, return to high-level
-
- export NewNewPtr, NewNewHandle, NewReallocHandle
- export NewSetPtrSize, NewSetHandleSize, NewMoveHHi
-
- NewNewPtr
- move.l pOldNewPtr,-(SP)
- bra.s Common
-
- NewNewHandle
- move.l pOldNewHandle,-(SP)
- bra.s Common
-
- NewReallocHandle
- move.l pOldReallocHandle,-(SP)
- bra.s Common
-
- NewSetPtrSize
- move.l pOldSetPtrSize,-(SP)
- bra.s Common
-
- NewSetHandleSize
- move.l pOldSetHandleSize,-(SP)
- bra.s Common
-
- NewMoveHHi
- move.l pOldMoveHHi,-(SP)
- ; bra.s Common
-
- Common
- movem.l allRegs,-(SP)
- move.w D1,-(SP)
- bsr PurgeAllBlocks
- movem.l (SP)+,allRegs
- rts
-
- ENDP
- END
-